var express = require('express');
var router = express.Router();
const {Setting} = require('../models');
const { failure, success, NotFoundError } = require('../utils/response');

// 查询系统信息
router.get('/', async function(req, res, next) {
    try {
        const setting = await Setting.findOne()
        if(!setting){
            throw new NotFoundError('系统信息未找到,请联系管理员')
        }
        success(res,'查询系统信息成功',{setting})
    } catch (error) {
        failure(res,error)
    }
    
});

module.exports = router